<?php include_once("../../common/common_setting_unit.php");         // 引入通用的设置文件 ?>
<?php include_once("controller/detail-list.php");                     // 当前页面的控制器 ?>
<?php include_once(ROOT_PATH_ . "/controller/common/module/head.php"); // 引入通用的头部 ?>


<?

if(isset($_REQUEST['now_extender']))

{

    $system_part = $_REQUEST['now_extender'];

}



if(isset($_REQUEST['nowpageid']))

{

    $nowpageid = $_REQUEST['nowpageid'];

}



if(isset($_REQUEST['sortby']))

{

    $sortby = $_REQUEST['sortby'];

}



if(isset($_REQUEST['term_nid']))

{

    $term_nid = $_REQUEST['term_nid'];

}



?>



<?php include_once("controller/model/language.php");//属性名字 ?>




<?php include_once($_SERVER['DOCUMENT_ROOT']."/controller/common/script/site-function.php"); ?>





<?php include_once("first_term.php"); ?>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <?php include_once(ROOT_PATH_ . "/controller/common/module/head.php"); // 引入通用的头部 ?>





    <script type="text/jscript" src="asset/js/js.js" ></script>



    <style>

        .layui-input-block {

            margin-left: 130px;

        }



        .layui-form-label {



            width: 100px;

        }





    </style>

</head>



<body>



<div id="topbar">

    <!--TopBar端點01-->

    <?php include ROOT_PATH_ . '/controller/common/module/topbar.php'; ?>
    <!--TopBar端點02-->

</div>



<div id="container">

    <!--Container端點01-->

    <div id="maincontent"   class="detail">

        <!--maincontent端點01-->



        <div id="sidebar">

            <?php include ROOT_PATH_ . '/controller/common/module/sidebar.php'; ?>

        </div>





        <div id="content">

            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">

                <legend><h1>添加<? echo $sys_title ?> 分类</h1></legend>

            </fieldset>









            <div class="<? echo $system_part ?>">



                <div class="term-detail-boxes layui-form">

                    <ul class="detail-box detail-boxing">

                        <form id="term_detail_form" method="post" action="term-add-function.php?now_extender=<? echo $system_part?>" enctype="multipart/form-data" name="uploadfile" onsubmit="return (term_name);" class="  layui-form-pane" >






                            <li class="name">

                                <label class="layui-form-label">分类名称：</label>

    <div class="layui-input-block"><input type="text" class="layui-input"  name="term_name" size="20" value=""></div>

                <em class="explain">(<u style="color:red">*必填项目</u>,填写本分类的标题)</em>

                            </li>




                            <li class="term"><label class="layui-form-label">所属分类：</label>



								<div class="layui-input-block">



<select name="term_term_id">
    <option value="root" selected="selected">当前所属分类:根目录 \</option>

<?php $term0=select_lines_all_items($table_prefix."term","","interm='root'"); ?>

<? for($i=0;$i<count($term0);$i++) { ?>

<option value="<?php echo $term0[$i]['nid'] ?>"> | - <?php echo $term0[$i]['name'] ?></option>


            <?php $term1[$i]=select_lines_all_items($table_prefix."term","","term1 = {$term0[$i]['nid']} && interm = 'term1'"); ?>

            <?for ($ii = 0; $ii < count($term1[$i]); $ii++) {?>
                <option value="<?php echo $term1[$i][$ii]['nid'] ?>"> |---- <?php echo $term1[$i][$ii]['name'] ?></option>


                        <?php $term2[$i][$ii]=select_lines_all_items($table_prefix."term","","term2 = {$term1[$i][$ii]['nid']} && interm = 'term2'"); ?>

                        <?for ($iii = 0; $iii < count($term2[$i][$ii]); $iii++) {?>
                            <option value="<?php echo $term2[$i][$ii][$iii]['nid'] ?>"> |------ <?php echo $term2[$i][$ii][$iii]['name'] ?></option>
                        <?php } ?>


            <?php } ?>
<?php } ?>
 </select>



</div>

                <em class="explain">(选择本分类对应的上级分类，如是一级分类，请选择“根目录”)</em></li>



                            <li class="listorder"><label class="layui-form-label">列表排序：</label>

    <div class="layui-input-block"><input type="text" class="layui-input"  name="term_listorder" size="20" value="0" onkeydown="onlyNum();" onfocus="checkdefault(term_listorder)" onblur="checkempty(term_listorder)"></div>

                <em class="explain">(填写本分类在所属前台列表下的列表排序，数字越大，排序越靠前)</em></li>





                            <li class="publish"><label class="layui-form-label">发布状态：</label>

                                <div class="layui-input-block">

                                    <input name='term_publish' type='radio' value='1' id="publish_now" title="立即发布"/>



    								<input name='term_publish' type='radio' value='0' id="publish_later"  checked="checked" title="暂未发布"  />



                                </div>

                <em class="explain">(选择立即发布，以上信息才能在前台显示；选择暂未发布，只对以上信息进行保存，不在前台显示)</em>

                            </li>



                            <li class="inputtime" style="display: none"><label class="layui-form-label">输入时间：</label>

    <div class="layui-input-block"><input type="text" class="layui-input"  name="term_inputtime" size="20" value="<? echo date("Y-m-d H:i:s") ?>" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})" class="laydate-icon"></div>

                <em class="explain">(填写分类录入时间)</em></li>





	 			<hr/>

                            <div class="function">

                                <input type="hidden" name="detail_attr" id="detail_attr" />

                                <button class="layui-btn "  type="button" lay-submit lay-filter="formSub">立即提交</button>

                                <input type="reset" class="layui-btn" value="重置"/>

                            </div>

                        </form>

                    </ul>

                </div>

            </div>



            <!--content端點01-->

        </div>

        <!--maincontent端點01-->

        <br class="clearfloat" />

    </div>

    <!--container端點01-->

</div>


<?php include  ROOT_PATH_."/controller/modules/footer.php"; ?>


<script type="text/javascript">

    layui.use(['transfer', 'layer', 'util', 'form'], function(){

        var $ = layui.$

            ,transfer = layui.transfer

            ,layer = layui.layer

            ,util = layui.util

            ,form = layui.form;


        form.on('submit(formSub)', function(data){


            $('.layui-form-pane').submit()



        })



    });





    //上移

    function moveUp(dom) {

        //找到选中的li

        var index = $("#"+dom+" ul" ).eq(1).find('.layui-form-checked').parent();

        if(typeof(index[0]) == "undefined") {

            layer.msg("请选中后，再进行移位操作");

            return;

        }

        for(var i=0;i<index.length;i++){

            if(index.eq(i).index()!=0){

                index.eq(i).prev().before(index.eq(i));

            }

        }



    }



    //置顶

    function moveUpMax(dom) {

        //找到选中的li

        var index = $("#"+dom+" ul" ).eq(1).find('.layui-form-checked').parent();

        if(typeof(index[0]) == "undefined") {

            layer.msg("请选中后，再进行移位操作");

            return;

        }

        for(var i=index.length-1;i>=0;i--){

            do{

                index.eq(i).prev().before(index.eq(i));

            }while(index.eq(i).index()!=0)

        }

    }



    //下移

    function moveDown(dom) {

        //找到选中的li

        var index = $("#"+dom+" ul" ).eq(1).find('.layui-form-checked').parent();

        if(typeof(index[0]) == "undefined") {

            layer.msg("请选中后，再进行移位操作");

            return;

        }

        for(var i=index.length-1;i>=0;i--){

            if(index.eq(i).index()!=($("#"+dom+" ul li").length-1)){

                index.eq(i).next().after(index.eq(i));

            }

        }

    }



    //置底

    function moveDownMax(dom) {

        //找到选中的li

        var index = $("#"+dom+" ul" ).eq(1).find('.layui-form-checked').parent();

        if(typeof(index[0]) == "undefined") {

            layer.msg("请选中后，再进行移位操作");

            return;

        }

        for(var i=0;i<index.length;i++){

            do{

                index.eq(i).next().after(index.eq(i));

            }while(index.eq(i).index()!=($("#"+dom+" ul").eq(1).find("li").length-1))

        }

    }





</script>

</body>

</html>